/*
 * @Author: fanweihua
 * @Date: 2020-12-10 11:51:58
 * @LastEditTime: 2021-07-15 11:49:13
 * @Description: React、ReactDOM、RootRouter、Redux
 */
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import RootRouter from './router/index'; // 路由入口
import { Provider } from 'react-redux';
import './index.less'; // 主框架样式
import { title } from './config/systemConfig'; // 系统内部配置文件
import FastClick from 'fastclick';
import registerStore from '@/common/store/registerStore';
if (module.hot && process.env.NODE_ENV === 'development') {
  module.hot.accept();
}
if (title) {
  document.title = title;
}
FastClick.attach(document.body);
// 创建store
const context = require.context('./model', true, /\.js$/);
const storeRegister = registerStore();
const store = storeRegister.useModel(context.keys().map(key => context(key).default)).run();
const rootContainer = (
  <Provider store={store}>
    <RootRouter />
  </Provider>
);
ReactDOM.render(rootContainer, document.getElementById(`root`));
